<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>档案添加</title>
<script src="libs/jquery-1.12.1.min.js"></script>
<script type="text/javascript" src="libs/jquery.backstretch.min.js"></script>
<script type="text/javascript" src="libs/md5.min.js"></script>
<link href="libs/css/bootstrap.min.css" rel="stylesheet">
<script src="libs/bootstrap.min.js"></script>
<script type="text/javascript" src="libs/jquery.backstretch.min.js"></script>

</head>
<body>
<nav class="navbar navbar-default">
	<div class="container-fluid">
		<!-- Brand and toggle get grouped for better mobile display -->
		<div class="navbar-header">
			<a class="navbar-brand" href="#">用户  _<span id="nickname"></span></a>
		</div>

		<!-- Collect the nav links, forms, and other content for toggling -->
		<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
	      <ul class="nav navbar-nav">
	        <li ><a href="homepage.html">首页 <span class="sr-only">(current)</span></a></li>
	        <li><a href="#">Link2</a></li>
	        <li class="dropdown">
	          <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">档案管理 <span class="caret"></span></a>
	          <ul class="dropdown-menu">
	            <li><a href="archiveadd.html">添加档案</a></li>
	            <li><a href="#">删除档案 </a></li>
	            <li role="separator" class="divider"></li>
	            <li><a href="#">查看档案</a></li>
	            <li role="separator" class="divider"></li>
	            <li><a href="#">One more separated link</a></li>
	          </ul>
	        </li>
	      </ul>
	      
	      <form class="navbar-form navbar-left" role="search">
	        <div class="form-group">
	          <input type="text" class="form-control" placeholder="档案号或者ID" id="arc_id">
	        <button type="button" class="btn btn-default" id="hpbut">查询</button>
	        </div>
	      </form>
	      
	      <ul class="nav navbar-nav navbar-right">
	        <li><a href="#">Link3</a></li>
	        <li class="dropdown">
	          <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">用户操作 <span class="caret"></span></a>
	          <ul class="dropdown-menu">
	            <li><a href="#">更换用户名</a></li>
	            <li role="separator" class="divider"></li>
	            <li><button type="button" class="btn btn-link" id="quit">用户退出</button></li>
	          </ul>
	        </li>
	      </ul>
		</div><!-- /.navbar-collapse -->
	</div><!-- /.container-fluid -->
</nav>
<div class="container-fluid">
	<div class="row">
		<div class="col-lg-3">
			<div class="form-group" >
				<label for="archive_id" style="color: pick" >档案号</label>
				<input type="text" class="form-control" id="archive_id">
			</div>
			<div class="form-group" >
				<label for="identity" style="color: pick">身份证号</label>
				<input type="text" class="form-control" id="identity" >			
			</div>
			<div class="form-group" >
				<label for="name" style="color: pick">姓名</label>
				<input type="text" class="form-control" id="name" >			
			</div>
			<div class="form-group" >
				<label for="gender" style="color: pick">性别</label>
				<input type="text" class="form-control" id="gender" >			
			</div>
			<div class="form-group" >
				<label for="birthday" style="color: pick">出生日期</label>
				<input type="date" class="form-control" id="birthday" >			
			</div>
			<div class="form-group" >
				<label for="date_retire1" style="color: pick">预计退休日期</label>
				<input type="date" class="form-control" id="date_retire1" >			
			</div>
			<div class="form-group" >
				<label for="date_retire2" style="color: pick">实际退休日期</label>
				<input type="date" class="form-control" id="date_retire2" >			
			</div>
			<div class="form-group" >
				<label for="sp" style="color: pick">特殊工种</label>
				<input type="text" class="form-control" id="sp" >			
			</div>
			<div class="form-group" >
				<label for="fc" style="color: pick">女管理岗位</label>
				<input type="text" class="form-control" id="fc" >			
			</div>
			<div class="form-group" >
				<label for="title" style="color: pick">职称</label>
				<input type="text" class="form-control" id="title" >			
			</div>
			<div class="form-group" >
				<label for="seniority" style="color: pick">工龄</label>
				<input type="text" class="form-control" id="seniority" >			
			</div>
			<button id="archiveadd" class="btn btn-success btn-block">添加</button>
			
		</div>
	</div>
</div>

<script type="text/javascript">
$.backstretch("picture/beautiful.jpg")
</script>

<script type="text/javascript">
$(function(){
	$('#archiveadd').click(function(){
		$.post('hero.action',{
			archive_id : $('#archive_id').val(),
			identity : $('#identity').val(),
			name : $('#name').val(),
			gender : $('#gender').val(),
			birthday : $('#birthday').val(),
			date_retire1 : $('#date_retire1').val(),
			date_retire2 : $('#date_retire2').val(),
			sp : $('#sp').val(),
			fc : $('#fc').val(),
			title : $('#title').val(),
			seniority : $('#seniority').val(),
		},alert('添加成功'));
	});
	$('#hpbut').click(function(){
		$.getJSON('queryOne.action',{
			archive_id : $('#arc_id').val(),
		},function(res){
			console.log(res);
			if(res=='err'){alert('档案号或身份号错误');}
			else{
				window.location.href='archiveif.html';
			}
			/* $('#id').text(res.id);
			$('#danganhao').text(res.archive_id);
			$('#identity').text(res.identity);
			$('#name').text(res.name); */
		});
	});
	$.getJSON('querynn.action',function(res){
		console.log(res);
		$('#nickname').text(res.nickname);
	});
	$('#quit').click(function(){
		$.post('quit.action',{
		},function(res){
			if("quit"==res){window.location.href='login.html';}
		});
	});
});

</script>

</body>
</html>